﻿<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/Main.master" CodeBehind="StockFilter.aspx.cs" Inherits="StockCrawler.StockFilter" %>

<%@ Register Assembly="DevExpress.Web.v14.2, Version=14.2.9.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Data.Linq" TagPrefix="dx" %>
<%@ Register Src="~/UserControl/ucHistoryInfo.ascx" TagPrefix="uc1" TagName="ucHistoryInfo" %>
<%--<%@ Register Src="~/UserControl/ucStockList.ascx" TagPrefix="uc1" TagName="ucStockList" %>--%>

<asp:Content ID="Content" ContentPlaceHolderID="MainContent" runat="server">
    <link rel="stylesheet" type="text/css" href="Content/StockFilter.css" />
    <script src="Scripts/History.js" type="text/javascript"></script>
    <div id="filter_stock" style="margin: 10px 0px 10px 20px;">
        <table style="width: 100%;">
            <tr>
                <td style="width: 100px">
                    <dx:ASPxLabel ID="ASPxLabelSelect" runat="server" Text="Lọc cổ phiếu">
                    </dx:ASPxLabel>
                </td>
                <td style="width: 130px">
                    <dx:ASPxComboBox ID="cboSelect" Width="120px" ClientInstanceName="cboSelectClient" runat="server" SelectedIndex="2" Style="margin-left: 0px" AutoPostBack="True" OnSelectedIndexChanged="cboSelect_SelectedIndexChanged">
                        <Items>
                            <dx:ListEditItem Text="All" Value="0" />
                            <dx:ListEditItem Text="Đánh dấu" Value="1" />
                            <dx:ListEditItem Text="Trần" Value="2" />
                            <dx:ListEditItem Text="Sàn" Value="3" />
                            <dx:ListEditItem Text="Tăng" Value="4" />
                            <dx:ListEditItem Text="Giảm" Value="5" Selected="True" />
                            <dx:ListEditItem Text="Mới lên sàn" Value="6" />
                            <dx:ListEditItem Text="KL tăng đột biến" Value="7" />
                            <dx:ListEditItem Text="KL giảm đột biến" Value="8" />
                        </Items>
                    </dx:ASPxComboBox>
                </td>
                <td style="width: 130px">
                    <dx:ASPxLabel ID="lblNumDaysBefore" runat="server" Text="Số ngày giảm liên tục">
                    </dx:ASPxLabel>
                </td>
                <td style="width: 50px">
                    <dx:ASPxComboBox ID="cboNumDaysBefore" Width="40px" ClientInstanceName="cboNumDaysClient" runat="server" SelectedIndex="2" Style="margin-left: 0px" OnSelectedIndexChanged="cboNumDaysBefore_SelectedIndexChanged" AutoPostBack="True">
                        <Items>
                            <dx:ListEditItem Text="1" Value="1" />
                            <dx:ListEditItem Text="2" Value="2" />
                            <dx:ListEditItem Text="3" Value="3" Selected="True" />
                            <dx:ListEditItem Text="4" Value="4" />
                            <dx:ListEditItem Text="5" Value="5" />
                            <dx:ListEditItem Text="6" Value="6" />
                            <dx:ListEditItem Text="7" Value="7" />
                            <dx:ListEditItem Text="8" Value="8" />
                            <dx:ListEditItem Text="9" Value="9" />
                            <dx:ListEditItem Text="10" Value="10" />
                        </Items>
                    </dx:ASPxComboBox>
                </td>
                <td style="width: 150px">
                    <dx:ASPxCheckBox ID="chkIncludeNoneChangeBefore" runat="server" Text="Gồm thay đổi = 0" AutoPostBack="True" OnCheckedChanged="chkIncludeNoneChangeBefore_CheckedChanged">
                    </dx:ASPxCheckBox>
                </td>
                <td style="width: 130px">
                    <dx:ASPxLabel ID="lblNumDaysAfter" runat="server" Text="Sau khi tăng liên tục">
                    </dx:ASPxLabel>
                </td>
                <td style="width: 50px">
                    <dx:ASPxComboBox ID="cboNumDaysAfter" Width="40px" ClientInstanceName="cboNumDaysClient" runat="server" SelectedIndex="2" Style="margin-left: 0px" AutoPostBack="True" OnSelectedIndexChanged="cboNumDaysAfter_SelectedIndexChanged">
                        <Items>
                            <dx:ListEditItem Text="0" Value="0" Selected="True" />
                            <dx:ListEditItem Text="1" Value="1" />
                            <dx:ListEditItem Text="2" Value="2" />
                            <dx:ListEditItem Text="3" Value="3" />
                            <dx:ListEditItem Text="4" Value="4" />
                            <dx:ListEditItem Text="5" Value="5" />
                            <dx:ListEditItem Text="6" Value="6" />
                            <dx:ListEditItem Text="7" Value="7" />
                            <dx:ListEditItem Text="8" Value="8" />
                            <dx:ListEditItem Text="9" Value="9" />
                            <dx:ListEditItem Text="10" Value="10" />
                        </Items>
                    </dx:ASPxComboBox>
                </td>
                <td style="width: 150px">
                    <dx:ASPxCheckBox ID="chkIncludeNoneChangeAfter" runat="server" Text="Gồm thay đổi = 0" AutoPostBack="True" OnCheckedChanged="chkIncludeNoneChangeAfter_CheckedChanged">
                    </dx:ASPxCheckBox>
                </td>
                <td style="width: 80px">
                    <dx:ASPxLabel ID="ASPxLabel4" runat="server" Text="KL giao dịch">
                    </dx:ASPxLabel>
                </td>
                <td style="width: 100px">
                    <dx:ASPxComboBox ID="cboVolumnRange" Width="80px" ClientInstanceName="cboKLGDClient" runat="server" SelectedIndex="2" Style="margin-left: 0px" AutoPostBack="True" OnSelectedIndexChanged="cboVolumnRange_SelectedIndexChanged">
                        <Items>
                            <dx:ListEditItem Text="All" Value="0" />
                            <dx:ListEditItem Text="> 1,000" Value="1000" />
                            <dx:ListEditItem Text="> 5,000" Value="5000" />
                            <dx:ListEditItem Text="> 10,000" Value="10000" Selected="True" />
                            <dx:ListEditItem Text="> 30,000" Value="30000" />
                            <dx:ListEditItem Text="> 50,000" Value="50000" />
                            <dx:ListEditItem Text="> 100,000" Value="100000" />
                        </Items>
                    </dx:ASPxComboBox>
                </td>
                <td style="width: 90px">
                    <dx:ASPxLabel ID="ASPxLabel1" runat="server" Text="Giá trị thay đổi">
                    </dx:ASPxLabel>
                </td>
                <td style="width: 70px">
                    <dx:ASPxComboBox ID="cboChangedRange" Width="60px" ClientInstanceName="cboKLGDClient" runat="server" SelectedIndex="2" Style="margin-left: 0px" AutoPostBack="True" OnSelectedIndexChanged="cboChangedRange_SelectedIndexChanged">
                        <Items>
                            <dx:ListEditItem Text="All" Value="abs(thay_doi) >= 0" Selected="True" />
                            <dx:ListEditItem Text=">= 0.5" Value="abs(thay_doi) >= 0.5" />
                            <dx:ListEditItem Text=">= 1" Value="abs(thay_doi) >= 1.0" />
                            <dx:ListEditItem Text=">= 1.5" Value="abs(thay_doi) >= 1.5" />
                        </Items>
                    </dx:ASPxComboBox>
                </td>
                <td style="width: 100px">
                    <dx:ASPxLabel ID="ASPxLabel2" runat="server" Text="KL đột biến gấp">
                    </dx:ASPxLabel>
                </td>
                <td style="width: 70px">
                    <dx:ASPxComboBox ID="cboTimes" Width="50px" ClientInstanceName="cboTimeslient" runat="server" SelectedIndex="2" Style="margin-left: 0px" AutoPostBack="True" OnSelectedIndexChanged="cboChangedRange_SelectedIndexChanged">
                        <Items>
                            <dx:ListEditItem Text="2" Value="2" />
                            <dx:ListEditItem Text="5" Value="5" />
                            <dx:ListEditItem Text="10" Value="10" Selected="True" />
                            <dx:ListEditItem Text="15" Value="15" />
                            <dx:ListEditItem Text="20" Value="20" />
                        </Items>
                    </dx:ASPxComboBox>
                </td>
                <td style="width: 50px">
                    <dx:ASPxLabel ID="ASPxLabel3" runat="server" Text="Loại CP">
                    </dx:ASPxLabel>
                </td>
                <td style="width: 70px">
                    <dx:ASPxComboBox ID="cboLoaiCP" Width="60px" ClientInstanceName="cboLoaiCPClient" runat="server" SelectedIndex="1" Style="margin-left: 0px" AutoPostBack="True" OnSelectedIndexChanged="cboChangedRange_SelectedIndexChanged">
                        <Items>
                            <dx:ListEditItem Text="All" Value="0" />
                            <dx:ListEditItem Text="Tốt" Value="1" Selected="True" />
                            <dx:ListEditItem Text="Xấu" Value="-1" />
                        </Items>
                    </dx:ASPxComboBox>
                </td>
            </tr>
        </table>
    </div>
    <div id="stock" style="height: 90%;">
        <dx:ASPxSplitter ID="ASPxSplitter2" runat="server" Height="100%">
            <Styles>
                <Pane>
                    <Paddings Padding="0px" />
                </Pane>
            </Styles>
            <Panes>
                <dx:SplitterPane MinSize="400px" Size="430" Name="stockContainer" ShowCollapseBackwardButton="True">
                    <ContentCollection>
                        <dx:SplitterContentControl runat="server">
                            <dx:ASPxGridView ID="gridViewStock" Width="100%" KeyFieldName="id_stock" runat="server" AutoGenerateColumns="False" OnDataBound="gridViewStock_DataBound" OnHtmlRowPrepared="gridViewStock_HtmlRowPrepared">
                                <%--<Settings ShowFilterRow="True" ShowFilterRowMenu="True" ShowFooter="True" VerticalScrollBarMode="Auto" HorizontalScrollBarMode="Auto" VerticalScrollableHeight="455" />--%>
                                <ClientSideEvents SelectionChanged="getIndex" />
                                <Columns>
                                    <dx:GridViewDataTextColumn Caption="ID" FieldName="id_stock" ShowInCustomizationForm="True" Visible="False" VisibleIndex="0">
                                    </dx:GridViewDataTextColumn>
                                    <%--<dx:GridViewCommandColumn ShowSelectCheckbox="True" VisibleIndex="1" Width="40">
                                    </dx:GridViewCommandColumn>--%>
                                    <dx:GridViewDataCheckColumn VisibleIndex="1" FieldName="isRemark" Caption="#" Width="40">
                                        <DataItemTemplate>
                                            <dx:ASPxCheckBox ID="chkIsRemark" ClientInstanceName="chkIsRemarkClient" runat="server" AutoPostBack="true" Checked='<%# Eval("isRemark") %>' OnCheckedChanged="chkIsRemark_CheckedChanged">
                                            </dx:ASPxCheckBox>
                                        </DataItemTemplate>
                                    </dx:GridViewDataCheckColumn>
                                    <dx:GridViewDataTextColumn Caption="Mã" FieldName="code" ShowInCustomizationForm="True" VisibleIndex="1" Width="40">
                                    </dx:GridViewDataTextColumn>
                                    <dx:GridViewDataTextColumn Caption="Sàn" FieldName="stockexchange_name" ReadOnly="True" VisibleIndex="2" Width="50">
                                    </dx:GridViewDataTextColumn>
                                    <%--<dx:GridViewDataTextColumn Caption="Công ty" FieldName="name" ShowInCustomizationForm="True" VisibleIndex="3" Width="200px">
                                    </dx:GridViewDataTextColumn>--%>
                                    <dx:GridViewDataTextColumn FieldName="eps" ReadOnly="True" VisibleIndex="4" Width="50">
                                        <PropertiesTextEdit DisplayFormatString="#,###" />
                                    </dx:GridViewDataTextColumn>
                                    <dx:GridViewDataTextColumn FieldName="pe" ReadOnly="True" VisibleIndex="5" Width="40">
                                        <PropertiesTextEdit DisplayFormatString="#0.##" />
                                    </dx:GridViewDataTextColumn>
                                    <dx:GridViewDataTextColumn Caption="KLNY" FieldName="klcp_niemyet" ReadOnly="True" VisibleIndex="6" Width="80">
                                        <PropertiesTextEdit DisplayFormatString="#,###" />
                                    </dx:GridViewDataTextColumn>
                                    <dx:GridViewDataTextColumn Caption="KLĐLH" FieldName="klcp_luuhanh" ReadOnly="True" VisibleIndex="7" Width="80">
                                        <PropertiesTextEdit DisplayFormatString="#,###" />
                                    </dx:GridViewDataTextColumn>
                                    <dx:GridViewDataTextColumn FieldName="vcsh" ReadOnly="True" VisibleIndex="8" Width="90">
                                        <PropertiesTextEdit DisplayFormatString="#,###" />
                                    </dx:GridViewDataTextColumn>
                                    <dx:GridViewDataTextColumn FieldName="bv" ReadOnly="True" VisibleIndex="9" Width="40">
                                        <PropertiesTextEdit DisplayFormatString="#,###" />
                                    </dx:GridViewDataTextColumn>
                                    <dx:GridViewDataTextColumn FieldName="loaicp" ReadOnly="True" VisibleIndex="10" Width="40">
                                    </dx:GridViewDataTextColumn>
                                </Columns>
                                <SettingsBehavior AllowFocusedRow="true" ProcessFocusedRowChangedOnServer="True" AllowSelectByRowClick="True" AllowSelectSingleRowOnly="True" />
                                <SettingsPager Mode="ShowAllRecords" />
                                <%--<SettingsPager PageSize="20">
                                    <PageSizeItemSettings Items="20, 50, 100" Visible="True">
                                    </PageSizeItemSettings>
                                </SettingsPager>--%>
                                <Settings VerticalScrollBarMode="Auto" HorizontalScrollBarMode="Auto" VerticalScrollableHeight="485" />
                                <Border BorderWidth="0px"></Border>
                            </dx:ASPxGridView>
                            <%--<dx:LinqServerModeDataSource ID="LinqServerModeDataSourceStock" runat="server" ContextTypeName="StockCrawlerLib.StockDataClassesDataContext" OnSelecting="LinqServerModeDataSourceStock_Selecting" />--%>
                        </dx:SplitterContentControl>
                    </ContentCollection>
                </dx:SplitterPane>
                <dx:SplitterPane MinSize="350px">
                    <ContentCollection>
                        <dx:SplitterContentControl runat="server">
                            <dx:ASPxPageControl ID="StockTabPage" runat="server" ActiveTabIndex="0" EnableHierarchyRecreation="True" Width="100%">
                                <TabPages>
                                    <dx:TabPage Text="Lịch sử giao dịch">
                                        <ContentCollection>
                                            <dx:ContentControl ID="ContentControlHistory" runat="server">
                                                <div id="pricebox" runat="server" style="height: 30px; background-color: #1D1D1D; color: white">
                                                    <dx:ASPxLabel ID="lblInfo" runat="server" ClientInstanceName="lblInfoClient">
                                                    </dx:ASPxLabel>
                                                </div>
                                                <div>
                                                    <dx:ASPxGridView ID="gridViewHistory" ClientInstanceName="gridViewHistoryClient" Width="100%" runat="server" AutoGenerateColumns="false" KeyFieldName="id_stock" OnCustomCallback="gridViewHistory_CustomCallback" OnHtmlDataCellPrepared="gridViewHistory_HtmlDataCellPrepared">
                                                        <Columns>
                                                            <dx:GridViewDataDateColumn FieldName="stockexchange_name" Visible="false" VisibleIndex="1" Width="80" Caption="Ngày GD" SortOrder="Descending">
                                                            </dx:GridViewDataDateColumn>
                                                            <dx:GridViewDataDateColumn FieldName="ngay_giao_dich" VisibleIndex="2" Width="80" Caption="Ngày GD" SortOrder="Descending">
                                                            </dx:GridViewDataDateColumn>
                                                            <dx:GridViewDataTextColumn FieldName="gia_tran" VisibleIndex="3" Width="40" Caption="Trần">
                                                                <PropertiesTextEdit DisplayFormatString="#,##0.#0" />
                                                                <CellStyle ForeColor="Magenta">
                                                                </CellStyle>
                                                            </dx:GridViewDataTextColumn>
                                                            <dx:GridViewDataTextColumn FieldName="gia_san" VisibleIndex="4" Width="40" Caption="Sàn">
                                                                <PropertiesTextEdit DisplayFormatString="#,##0.#0" />
                                                                <CellStyle ForeColor="#66CCFF">
                                                                </CellStyle>
                                                            </dx:GridViewDataTextColumn>
                                                            <dx:GridViewDataTextColumn FieldName="gia_tham_chieu" VisibleIndex="5" Width="40" Caption="TC">
                                                                <PropertiesTextEdit DisplayFormatString="#,##0.#0" />
                                                                <CellStyle ForeColor="#F7FF31">
                                                                </CellStyle>
                                                            </dx:GridViewDataTextColumn>
                                                            <dx:GridViewDataTextColumn FieldName="gia_dong_cua" VisibleIndex="6" Width="65" Caption="Đóng cửa">
                                                                <PropertiesTextEdit DisplayFormatString="#,##0.#0" />
                                                            </dx:GridViewDataTextColumn>
                                                            <dx:GridViewDataTextColumn FieldName="thay_doi" VisibleIndex="7" Width="40" Caption="+/-">
                                                                <PropertiesTextEdit DisplayFormatString="#0.#0" />
                                                            </dx:GridViewDataTextColumn>
                                                            <dx:GridViewDataTextColumn FieldName="thay_doi_percent" VisibleIndex="8" Width="40" Caption="%">
                                                                <PropertiesTextEdit DisplayFormatString="#0.#0" />
                                                            </dx:GridViewDataTextColumn>
                                                            <dx:GridViewDataTextColumn FieldName="klgd_khop_lenh" VisibleIndex="12" Width="80" Caption="KLGD">
                                                                <PropertiesTextEdit DisplayFormatString="#,###" />
                                                            </dx:GridViewDataTextColumn>
                                                            <dx:GridViewDataTextColumn FieldName="gtgd_khop_lenh" VisibleIndex="13" Width="110" Caption="GTGD">
                                                                <PropertiesTextEdit DisplayFormatString="#,###" />
                                                            </dx:GridViewDataTextColumn>
                                                            <dx:GridViewDataTextColumn FieldName="so_lenh_mua" VisibleIndex="14" Width="70" Caption="Lệnh mua">
                                                                <PropertiesTextEdit DisplayFormatString="#,###" />
                                                            </dx:GridViewDataTextColumn>
                                                            <dx:GridViewDataTextColumn FieldName="kl_dat_mua" VisibleIndex="15" Width="80" Caption="KL đặt mua">
                                                                <PropertiesTextEdit DisplayFormatString="#,###" />
                                                            </dx:GridViewDataTextColumn>
                                                            <dx:GridViewDataTextColumn FieldName="so_lenh_ban" VisibleIndex="16" Width="70" Caption="Lệnh bán">
                                                                <PropertiesTextEdit DisplayFormatString="#,###" />
                                                            </dx:GridViewDataTextColumn>
                                                            <dx:GridViewDataTextColumn FieldName="kl_dat_ban" VisibleIndex="17" Width="80" Caption="KL đặt bán">
                                                                <PropertiesTextEdit DisplayFormatString="#,###" />
                                                            </dx:GridViewDataTextColumn>
                                                            <dx:GridViewDataTextColumn FieldName="klgd_thoa_thuan" VisibleIndex="18" Width="90" Caption="KL thỏa thuận">
                                                                <PropertiesTextEdit DisplayFormatString="#,###" />
                                                            </dx:GridViewDataTextColumn>
                                                            <dx:GridViewDataTextColumn FieldName="klgd_nn_mua" VisibleIndex="19" Width="70" Caption="NN mua">
                                                                <PropertiesTextEdit DisplayFormatString="#,###" />
                                                            </dx:GridViewDataTextColumn>
                                                            <dx:GridViewDataTextColumn FieldName="klgd_nn_ban" VisibleIndex="20" Width="70" Caption="NN bán">
                                                                <PropertiesTextEdit DisplayFormatString="#,###" />
                                                            </dx:GridViewDataTextColumn>
                                                            <dx:GridViewDataTextColumn FieldName="klsh_nn_percent" VisibleIndex="21" Width="50" Caption="% NN">
                                                                <PropertiesTextEdit DisplayFormatString="#0.#0" />
                                                            </dx:GridViewDataTextColumn>
                                                            <dx:GridViewDataTextColumn FieldName="klsh_nn_con_lai" VisibleIndex="22" Width="100" Caption="Room còn">
                                                                <PropertiesTextEdit DisplayFormatString="#,###" />
                                                            </dx:GridViewDataTextColumn>
                                                            <dx:GridViewDataTextColumn FieldName="klsh_nn" VisibleIndex="23" Width="100" Caption="Room">
                                                                <PropertiesTextEdit DisplayFormatString="#,###" />
                                                            </dx:GridViewDataTextColumn>
                                                        </Columns>
                                                        <ClientSideEvents ColumnSorting="onSorting" />
                                                        <SettingsBehavior AllowSelectByRowClick="true" />
                                                        <Settings VerticalScrollBarMode="Auto" HorizontalScrollBarMode="Auto" VerticalScrollableHeight="415" />
                                                        <SettingsPager Mode="ShowAllRecords" />
                                                        <Styles>
                                                            <Row BackColor="#1D1D1D" ForeColor="White">
                                                            </Row>
                                                        </Styles>
                                                    </dx:ASPxGridView>
                                                    //
                                                </div>
                                            </dx:ContentControl>
                                        </ContentCollection>
                                    </dx:TabPage>
                                    <dx:TabPage Text="Tin tức">
                                        <ContentCollection>
                                            <dx:ContentControl ID="ContentControl2" runat="server">
                                                <div id="Div1" runat="server" style="height: 30px; background-color: #1D1D1D; color: white">
                                                    <dx:ASPxLabel ID="lblNews" runat="server" ClientInstanceName="lblNewsClient">
                                                    </dx:ASPxLabel>
                                                </div>
                                            </dx:ContentControl>
                                        </ContentCollection>
                                    </dx:TabPage>
                                </TabPages>
                            </dx:ASPxPageControl>
                        </dx:SplitterContentControl>
                    </ContentCollection>
                </dx:SplitterPane>
            </Panes>
        </dx:ASPxSplitter>
        <dx:ASPxCallback ID="ASPxCallback1" runat="server" ClientInstanceName="Callback1" OnCallback="ASPxCallback1_Callback">
            <ClientSideEvents CallbackComplete="OnCallbackComplete" />
        </dx:ASPxCallback>
    </div>
</asp:Content>

